L=1000000000; S=3; T=3; M=100; stones=[13520773,56094979,13520774,227976321,265496617,442376089,75633637,755273022,13520776,118969221,13520775,223470050,13520779,309230626,13520778,227821627,323384010,464493511,13006833,38464786,22468188,22468189,22468184,40726315,22468185,46533247,362046553,22468186,186797905,22468183,83900881,22468187,238372675,36963460,120782179,164780764,96336028,93071798,235996153,289499761,80849268,80849264,80849265,80849267,80849266,360646416,404779932,102138401,452830357,861912985,101219980,80849263,201729701,428246578,285733009,158489031,80849269,61746153,149475946,62126761,322939304,322939305,322939309,86362289,322939303,86982281,43487096,322939308,2016334,231956257,322939306,831473893,507077633,488620131,441998539,5091269,4230631,166445335,856091641,20602497,379166901,379166904,379166905,350006398,538645865,379166906,230693193,77311297,15299369,379166907,136615430,379166903,310980450,325796383,545034951,379166902,549046187,287315857,153214531,440026249];